import 'package:flutter/material.dart';

class CommonFloatingActionButton extends StatelessWidget {
  final String text;
  final Function onTap;

  const CommonFloatingActionButton(
    this.text,
    this.onTap, {
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        if (onTap != null) onTap();
      },
      child: Container(
        height: 40.0,
        width: 300.0,
        margin: EdgeInsets.all(20.0),
        //添加发布房源的背景色
        decoration: BoxDecoration(
            color: Colors.green, borderRadius: BorderRadius.circular(20.0)),
        child: Center(
          child: Text(text,
              style: TextStyle(
                  color: Colors.white,
                  fontSize: 16.0,
                  fontWeight: FontWeight.w500)),
        ),
      ),
    );
  }
}
